home *** CD-ROM | disk | FTP | other *** search
- Path: chronicle.mti.sgi.com!austern
- From: abell@mindspring.com (Andrew Bell)
- Newsgroups: comp.std.c++
- Subject: Re: fstream constructors and strings
- Date: 01 Apr 1996 10:39:30 PST
- Organization: MindSpring Enterprises
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <4jnm7h$134a@mule2.mindspring.com>
- References: <315A8E72.1D3C@master.grad.hr>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Original-Date: Mon, 01 Apr 1996 04:34:14 GMT
- X-Newsreader: Forte Agent .99.82
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMWAi40y4NqrwXLNJAQEBTgIAtoA94ljOCaHfXXLy01Lf/fvX1I1bVMCO
- uGnfMtrZreDtZRYUpTRKfthHhR3w4iERkcG6HXSigW4EZ/txNUPoKg==
- =bwJy
- Originator: austern@isolde.mti.sgi.com
-
- Kresimir Fresl <fresl@master.grad.hr> wrote:
- >According to proposed standard one should write:
- > ifstream (file_name.c_str());
- >because implicit conversion of string to const char* is not defined.
-
- >I agree that implicit conversion is (almost always) dangerous, and I
- >_do not_ propose to add conversion operator to string class.
-
- Is there an explanation for why implicit conversion (at least to char
- *) is dangerous? It doesn't seem to me that requiring the member
- function call is that much safer, although admittedly it is easier to
- grep for. However, the added complexity of code w/o a conversion
- operator seems like it would add almost as many problems.
-
- I checked out the std.c++ faq, and I've read the lang.c++ faq not too
- long ago, and I didn't see a reference to this in either.
-
- Andrew Bell
- abell@mindspring.com
- ---
- [ comp.std.c++ is moderated. To submit articles: Try just posting with your
- newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
- comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
- Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu
- ]
-